home *** CD-ROM | disk | FTP | other *** search
/ Champak 130 / Vol 130.iso / games / hummer.swf / scripts / __Packages / engine / Auto.as next >
Encoding:
Text File  |  2007-01-08  |  20.1 KB  |  467 lines

  1. var ┬º\x01┬º = 117;
  2. while(true)
  3. {
  4.    if(eval("\x01") == 117)
  5.    {
  6.       set("\x01",eval("\x01") + 131);
  7.       ┬º┬ºpush(true);
  8.    }
  9.    else if(eval("\x01") == 248)
  10.    {
  11.       set("\x01",eval("\x01") + 9);
  12.       if(┬º┬ºpop())
  13.       {
  14.          set("\x01",eval("\x01") - 207);
  15.       }
  16.    }
  17.    else
  18.    {
  19.       if(eval("\x01") == 406)
  20.       {
  21.          set("\x01",eval("\x01") + 376);
  22.          nextFrame();
  23.          var _loc4_ = ┬º┬ºpop() + ┬º┬ºpop() * ┬º┬ºpop();
  24.          _loc1_[┬º┬ºconstant(6)](_loc5_);
  25.          _loc1_[┬º┬ºconstant(7)](_loc4_);
  26.          ┬º┬ºpop()[┬º┬ºpop()] = ┬º┬ºpop();
  27.          _loc2_[┬º┬ºconstant(39)] = function(ang)
  28.          {
  29.             var _loc2_ = new eval(┬º┬ºconstant(1))[┬º┬ºconstant(3)](this[┬º┬ºconstant(9)](),this[┬º┬ºconstant(12)]());
  30.             _loc2_[┬º┬ºconstant(38)](ang);
  31.             return _loc2_;
  32.          };
  33.          _loc2_[┬º┬ºconstant(40)] = function(v)
  34.          {
  35.             return this[┬º┬ºconstant(9)]() * v[┬º┬ºconstant(9)]() + this[┬º┬ºconstant(12)]() * v[┬º┬ºconstant(12)]();
  36.          };
  37.          _loc2_[┬º┬ºconstant(41)] = function()
  38.          {
  39.             return new eval(┬º┬ºconstant(1))[┬º┬ºconstant(3)](- this[┬º┬ºconstant(12)](),this[┬º┬ºconstant(9)]());
  40.          };
  41.          _loc2_[┬º┬ºconstant(42)] = function(v)
  42.          {
  43.             return this[┬º┬ºconstant(40)](v) == 0;
  44.          };
  45.          _loc2_[┬º┬ºconstant(43)] = function(v)
  46.          {
  47.             return this[┬º┬ºconstant(42)](v);
  48.          };
  49.          _loc2_[┬º┬ºconstant(44)] = function(v)
  50.          {
  51.             var _loc3_ = this[┬º┬ºconstant(40)](v);
  52.             var _loc2_ = _loc3_ / (this[┬º┬ºconstant(29)]() * v[┬º┬ºconstant(29)]());
  53.             return eval(┬º┬ºconstant(1))[┬º┬ºconstant(33)][┬º┬ºconstant(45)](_loc2_);
  54.          };
  55.          _loc2_[┬º┬ºconstant(9)] = function()
  56.          {
  57.             return this[┬º┬ºconstant(46)];
  58.          };
  59.          _loc2_[┬º┬ºconstant(6)] = function(x)
  60.          {
  61.             this[┬º┬ºconstant(46)] = x;
  62.             return this[┬º┬ºconstant(9)]();
  63.          };
  64.          _loc2_[┬º┬ºconstant(12)] = function()
  65.          {
  66.             return this[┬º┬ºconstant(47)];
  67.          };
  68.          _loc2_[┬º┬ºconstant(7)] = function(y)
  69.          {
  70.             this[┬º┬ºconstant(47)] = y;
  71.             return this[┬º┬ºconstant(12)]();
  72.          };
  73.          _loc2_[┬º┬ºconstant(48)] = function()
  74.          {
  75.             return this[┬º┬ºconstant(29)]();
  76.          };
  77.          _loc2_[┬º┬ºconstant(49)] = function(len)
  78.          {
  79.             this[┬º┬ºconstant(31)](len);
  80.             return this[┬º┬ºconstant(48)]();
  81.          };
  82.          _loc2_[┬º┬ºconstant(50)] = function()
  83.          {
  84.             return this[┬º┬ºconstant(32)]();
  85.          };
  86.          _loc2_[┬º┬ºconstant(51)] = function(ang)
  87.          {
  88.             this[┬º┬ºconstant(35)](ang);
  89.             return this[┬º┬ºconstant(50)]();
  90.          };
  91.          ┬º┬ºconstant(55)(eval(┬º┬ºconstant(1))[┬º┬ºconstant(3)][┬º┬ºconstant(5)],null,1);
  92.          ┬º┬ºpush(_loc2_[┬º┬ºconstant(53)](┬º┬ºconstant(52),_loc2_[┬º┬ºconstant(50)],_loc2_[┬º┬ºconstant(51)]));
  93.          ┬º┬ºpush(_loc2_[┬º┬ºconstant(53)](┬º┬ºconstant(54),_loc2_[┬º┬ºconstant(48)],_loc2_[┬º┬ºconstant(49)]));
  94.          ┬º┬ºpush(_loc2_[┬º┬ºconstant(53)](┬º┬ºconstant(20),_loc2_[┬º┬ºconstant(9)],_loc2_[┬º┬ºconstant(6)]));
  95.          ┬º┬ºpush(_loc2_[┬º┬ºconstant(53)](┬º┬ºconstant(21),_loc2_[┬º┬ºconstant(12)],_loc2_[┬º┬ºconstant(7)]));
  96.          break;
  97.       }
  98.       if(eval("\x01") == 257)
  99.       {
  100.          set("\x01",eval("\x01") - 207);
  101.          break;
  102.       }
  103.       if(eval("\x01") == 50)
  104.       {
  105.          set("\x01",eval("\x01") + 770);
  106.          ┬º┬ºpush(true);
  107.       }
  108.       else if(eval("\x01") == 820)
  109.       {
  110.          set("\x01",eval("\x01") - 414);
  111.          if(┬º┬ºpop())
  112.          {
  113.             set("\x01",eval("\x01") + 376);
  114.          }
  115.       }
  116.       else if(eval("\x01") == 782)
  117.       {
  118.          set("\x01",eval("\x01") + 103);
  119.          ┬º┬ºpush(true);
  120.       }
  121.       else
  122.       {
  123.          if(eval("\x01") != 885)
  124.          {
  125.             if(eval("\x01") == 827)
  126.             {
  127.                set("\x01",eval("\x01") - 383);
  128.                ┬º┬ºpush(┬º┬ºpop() >>> ┬º┬ºpop());
  129.                break;
  130.             }
  131.             if(eval("\x01") == 444)
  132.             {
  133.                set("\x01",eval("\x01") - 259);
  134.                if(!_global.engine)
  135.                {
  136.                   _global.engine = new Object();
  137.                }
  138.                ┬º┬ºpop();
  139.                if(!_global.engine.Auto)
  140.                {
  141.                   var _loc2_ = engine.Auto = function(goal, nname, carIni, vert, playerFlag, gameOFunc)
  142.                   {
  143.                      this.gameOverFunc = gameOFunc;
  144.                      var _loc4_ = new math.Vector(carIni._x,carIni._y);
  145.                      this.poly = new math.Polygon(goal,nname,_loc4_,vert,carIni._rotation);
  146.                      this.autoRotation = carIni._rotation;
  147.                      this.autoRotationCur = carIni._rotation;
  148.                      this.autoRotationDx = 5;
  149.                      this.autoSpeedMax = 7;
  150.                      this.autoSpeedDx = 0.5;
  151.                      this.autoSpeedBackDx = 0.2;
  152.                      this.kofSpeed = 1;
  153.                      this.kofAutoV = 0.95;
  154.                      this.kofUdarV = 0.9;
  155.                      this.labels = 0;
  156.                      this.labs = 0;
  157.                      this.mass = 100;
  158.                      this.autoSpeed = 0;
  159.                      this.inRoud = 1;
  160.                      this.amountIterations = 0;
  161.                      this.udarV = new math.Vector(0,0);
  162.                      this.autoV = new math.Vector(0,0);
  163.                      this.objName = nname;
  164.                      this.gameEngine = goal;
  165.                      this.skins = new Array();
  166.                      this.player = playerFlag != undefined ? playerFlag : false;
  167.                      this.update = this.iteration;
  168.                      if(this.player == true)
  169.                      {
  170.                         this.sound = new Object();
  171.                         this.sound.snd_motor = _root.soundArc.playSound("motor",0,true);
  172.                         this.sound.snd_gas = _root.soundArc.playSound("gas",0,true);
  173.                         this.sound.snd_gas.val = 0;
  174.                         this.sound.snd_gas.setVolume(0);
  175.                      }
  176.                   }.prototype;
  177.                   _loc2_.destroy = function()
  178.                   {
  179.                      for(var _loc2_ in this)
  180.                      {
  181.                         this[_loc2_].removeMovieClip();
  182.                         delete this[_loc2_];
  183.                      }
  184.                   };
  185.                   _loc2_.checkInRoud = function()
  186.                   {
  187.                      var _loc2_ = 1;
  188.                      if(this.player)
  189.                      {
  190.                         _loc2_ += !this.gameEngine.trassa.trassa.hitTest(this.poly.vertex[1].x + this.poly.pos.x,this.poly.vertex[1].y + this.poly.pos.y,true) ? 0 : 1;
  191.                         _loc2_ += !this.gameEngine.trassa.trassa.hitTest(this.poly.vertex[2].x + this.poly.pos.x,this.poly.vertex[2].y + this.poly.pos.y,true) ? 0 : 1;
  192.                         _loc2_ = _loc2_ != 0 ? (_loc2_ != 1 ? 1 : 0.9) : 0.8;
  193.                      }
  194.                      return _loc2_;
  195.                   };
  196.                   _loc2_.get360 = function(num)
  197.                   {
  198.                      return num - 360 * Math.floor(num / 360);
  199.                   };
  200.                   _loc2_.checkFinish = function()
  201.                   {
  202.                      this.goalLabel = this.gameEngine.trassa["l" + this.labels];
  203.                      if(this.goalLabel.hitTest(this.poly.mc))
  204.                      {
  205.                         this.labels = this.labels + 1;
  206.                         if(!this.player)
  207.                         {
  208.                         }
  209.                         if(this.labels >= this.gameEngine.amount)
  210.                         {
  211.                            this.labs += 1;
  212.                            this.labels = 0;
  213.                            if(!this.player)
  214.                            {
  215.                            }
  216.                         }
  217.                         if(this.labs >= _root.gameInfo.settings.countLabs && this.labels > 0)
  218.                         {
  219.                            if(this.player)
  220.                            {
  221.                               this.update = this.iteration;
  222.                               this.amountIterationsFinished = this.amountIterations - this.amountIterationsStart;
  223.                               this.updateTime = undefined;
  224.                               this.sound.snd_gas.setVolume(0);
  225.                               this.gameOverFunc.apply(this,[true,this.amountIterationsFinished,this.objName]);
  226.                            }
  227.                            else
  228.                            {
  229.                               this.update = this.iteration;
  230.                               this.amountIterationsFinished = this.amountIterations - this.amountIterationsStart;
  231.                               this.updateTime = undefined;
  232.                               this.sound.snd_gas.setVolume(0);
  233.                               this.gameOverFunc.apply(this,[false,this.amountIterationsFinished,this.objName]);
  234.                            }
  235.                         }
  236.                      }
  237.                      var _loc3_ = new Object();
  238.                      _loc3_.x = this.goalLabel._x;
  239.                      _loc3_.y = this.goalLabel._y;
  240.                      return _loc3_;
  241.                   };
  242.                   _loc2_.updateWay = function()
  243.                   {
  244.                      this.iteration(true);
  245.                      var _loc4_ = new Object();
  246.                      _loc4_ = this.checkFinish();
  247.                      var _loc3_ = _loc4_.x - this.poly.pos.x;
  248.                      var _loc2_ = _loc4_.y - this.poly.pos.y;
  249.                      var _loc5_ = Math.max(Math.abs(_loc3_),Math.abs(_loc2_));
  250.                      _loc3_ /= _loc5_;
  251.                      _loc2_ /= _loc5_;
  252.                      var _loc8_ = new math.Vector(_loc3_,_loc2_);
  253.                      var _loc7_ = _loc8_.scaleNew(this.autoSpeedDx);
  254.                      this.autoSpeed = _loc7_.plusNew(this.autoV).getLength();
  255.                      if(this.autoSpeed < this.autoSpeedMax * this.kofSpeed)
  256.                      {
  257.                         this.autoV.plus(_loc7_);
  258.                      }
  259.                      var _loc6_ = this.gameEngine._parent.screens[0].getAngel(this.autoV.getAngle() - this.autoRotation) / 2;
  260.                      this.autoRotation += _loc6_;
  261.                      this.autoRotationCur = this.autoRotation;
  262.                      this.poly.rotatePoly(_loc6_);
  263.                   };
  264.                   _loc2_.chackKeys = function()
  265.                   {
  266.                      this.iteration(true);
  267.                      this.checkFinish();
  268.                      if(Key.isDown(this.keys[2]))
  269.                      {
  270.                         var _loc5_ = this.autoRotationDx * (this.autoSpeed / this.autoSpeedMax);
  271.                         this.autoRotation -= _loc5_;
  272.                         this.autoRotationCur = this.autoRotation;
  273.                         this.poly.rotatePoly(- _loc5_);
  274.                      }
  275.                      if(Key.isDown(this.keys[3]))
  276.                      {
  277.                         _loc5_ = this.autoRotationDx * (this.autoSpeed / this.autoSpeedMax);
  278.                         this.autoRotation += _loc5_;
  279.                         this.autoRotationCur = this.autoRotation;
  280.                         this.poly.rotatePoly(_loc5_);
  281.                      }
  282.                      this.autoSpeed = this.autoV.getLength();
  283.                      var _loc4_ = false;
  284.                      if(!Key.isDown(this.keys[4]))
  285.                      {
  286.                         var _loc2_ = this.autoRotation * 3.141592653589793 / 180;
  287.                         var _loc3_ = new math.Vector(0,0);
  288.                         if(Key.isDown(this.keys[0]))
  289.                         {
  290.                            _loc4_ = true;
  291.                            this.autoSpeed += this.autoSpeedDx;
  292.                            if(this.autoSpeed > this.autoSpeedMax)
  293.                            {
  294.                               this.autoSpeed = this.autoSpeedMax;
  295.                            }
  296.                            _loc3_ = new math.Vector(this.autoSpeedDx * Math.cos(_loc2_),this.autoSpeedDx * Math.sin(_loc2_));
  297.                            this.autoV.plus(_loc3_);
  298.                            var _loc6_ = new math.Vector(this.autoSpeed * Math.cos(_loc2_),this.autoSpeed * Math.sin(_loc2_));
  299.                            this.autoV.plus(_loc6_);
  300.                            this.autoV.scale(0.5);
  301.                         }
  302.                         if(Key.isDown(this.keys[1]))
  303.                         {
  304.                            _loc4_ = true;
  305.                            this.autoSpeed -= this.autoSpeedBackDx;
  306.                            _loc3_ = new math.Vector(this.autoSpeedBackDx * Math.cos(_loc2_),this.autoSpeedBackDx * Math.sin(_loc2_));
  307.                            this.autoV.minus(_loc3_);
  308.                         }
  309.                      }
  310.                   };
  311.                   _loc2_.updateTime = function(p)
  312.                   {
  313.                      var _loc6_ = this.amountIterations - this.amountIterationsStart;
  314.                      var _loc4_ = _loc6_ / 10;
  315.                      var _loc3_ = Math.floor(_loc4_);
  316.                      p.sec.text = _loc3_;
  317.                      p.msec.text = Math.round((_loc3_ - _loc4_) * 100);
  318.                      p.lapsTxt.text = (this.labs != _root.gameInfo.settings.countLabs ? this.labs + 1 : _root.gameInfo.settings.countLabs) + "/" + _root.gameInfo.settings.countLabs;
  319.                   };
  320.                   _loc2_.updatePreview = function(p, kof)
  321.                   {
  322.                      p.preview[this.objName]._x = this.poly.pos.x * kof - 100;
  323.                      p.preview[this.objName]._y = this.poly.pos.y * kof - 100;
  324.                   };
  325.                   _loc2_.updateSpeed = function(p)
  326.                   {
  327.                      var _loc2_ = this.autoSpeed / this.autoSpeedMax;
  328.                      p.speedometr.gotoAndStop(Math.round(15.6 * _loc2_));
  329.                      p.speed.text = Math.round(180 * _loc2_);
  330.                   };
  331.                   _loc2_.iteration = function(how)
  332.                   {
  333.                      this.autoSpeed = this.autoV.getLength();
  334.                      this.amountIterations = this.amountIterations + 1;
  335.                      var _loc3_ = this.checkInRoud();
  336.                      this.poly.pos.plus(this.udarV);
  337.                      this.poly.pos.plus(this.autoV);
  338.                      this.autoV.scale(this.kofAutoV - (1 - _loc3_));
  339.                      this.udarV.scale(this.kofUdarV - (1 - _loc3_));
  340.                      if(this.autoV.getLength() < 0.001)
  341.                      {
  342.                         this.autoV = new math.Vector(0,0);
  343.                      }
  344.                      if(this.udarV.getLength() < 0.001)
  345.                      {
  346.                         this.udarV = new math.Vector(0,0);
  347.                      }
  348.                      this.renderAuto();
  349.                      if(this.player)
  350.                      {
  351.                         var _loc4_ = _root.gameInfo.settings.effectValue * 0.5 * this.autoSpeed / this.autoSpeedMax;
  352.                         this.sound.snd_gas.setVolume(_loc4_);
  353.                         this.sound.snd_motor.setVolume(_root.gameInfo.settings.effectValue);
  354.                      }
  355.                   };
  356.                   _loc2_.boom = function(N, t, auto)
  357.                   {
  358.                      var _loc8_ = 1.01;
  359.                      var _loc10_ = new math.Vector(N.x * t * _loc8_,N.y * t * _loc8_);
  360.                      this.poly.minus(_loc10_);
  361.                      var _loc5_ = auto.poly.pos.x - this.poly.pos.x;
  362.                      var _loc4_ = auto.poly.pos.y - this.poly.pos.y;
  363.                      var _loc7_ = Math.max(Math.abs(_loc5_),Math.abs(_loc4_));
  364.                      _loc5_ /= _loc7_;
  365.                      _loc4_ /= _loc7_;
  366.                      var _loc9_ = new math.Vector(_loc5_,_loc4_);
  367.                      var _loc6_ = this.autoV.getLength() + auto.autoV.getLength();
  368.                      _loc7_ = this.mass + auto.mass;
  369.                      var _loc12_ = _loc9_.scaleNew(_loc6_ * (this.mass / _loc7_) * 0.5).rotateNew(180);
  370.                      var _loc11_ = _loc9_.scaleNew(_loc6_ * (auto.mass / _loc7_) * 0.5);
  371.                      _root.soundArc.playSound("crash",0,false,_loc6_ / 2 / this.autoSpeedMax);
  372.                      this.setUdarV(_loc12_);
  373.                      auto.setUdarV(_loc11_);
  374.                   };
  375.                   _loc2_.boom2 = function(N, t, obj)
  376.                   {
  377.                      var _loc6_ = 1.01;
  378.                      var _loc7_ = new math.Vector(N.x * t * _loc6_,N.y * t * _loc6_);
  379.                      this.poly.minus(_loc7_);
  380.                      var _loc4_ = obj.poly.pos.x - this.poly.pos.x;
  381.                      var _loc3_ = obj.poly.pos.y - this.poly.pos.y;
  382.                      var _loc9_ = Math.max(Math.abs(_loc4_),Math.abs(_loc3_));
  383.                      _loc4_ /= _loc9_;
  384.                      _loc3_ /= _loc9_;
  385.                      var _loc10_ = new math.Vector(_loc4_,_loc3_);
  386.                      var _loc5_ = this.autoV.getLength();
  387.                      _loc9_ = this.mass + obj.mass;
  388.                      var _loc11_ = _loc10_.scaleNew(_loc5_ * (this.mass / _loc9_)).rotateNew(180);
  389.                      _root.soundArc.playSound("crash",0,false,_loc5_ / 2 / this.autoSpeedMax);
  390.                      this.setUdarV(_loc11_);
  391.                   };
  392.                   _loc2_.getX = function()
  393.                   {
  394.                      return this.poly.pos.x;
  395.                   };
  396.                   _loc2_.getY = function()
  397.                   {
  398.                      return this.poly.pos.y;
  399.                   };
  400.                   _loc2_.getRotation = function()
  401.                   {
  402.                      return this.autoRotationCur;
  403.                   };
  404.                   _loc2_.setUdarV = function(V)
  405.                   {
  406.                      this.udarV.plus(V);
  407.                   };
  408.                   _loc2_.addSkin = function(g)
  409.                   {
  410.                      this.skins.push(g);
  411.                   };
  412.                   _loc2_.renderAuto = function()
  413.                   {
  414.                      this.poly.drawPoly();
  415.                      for(var _loc2_ in this.skins)
  416.                      {
  417.                         this.skins[_loc2_]._parent.updateObject(this.skins[_loc2_],this);
  418.                      }
  419.                   };
  420.                   _loc2_.setKeys = function(code1, code2, code3, code4)
  421.                   {
  422.                      this.keys = new Array();
  423.                      var _loc3_ = 0;
  424.                      while(_loc3_ < arguments.length)
  425.                      {
  426.                         this.keys.push(arguments[_loc3_]);
  427.                         _loc3_ = _loc3_ + 1;
  428.                      }
  429.                      this.player = true;
  430.                   };
  431.                   _loc2_.setKof = function(kof)
  432.                   {
  433.                      this.kofSpeed = kof;
  434.                      this.player = false;
  435.                   };
  436.                   _loc2_.setInfoPanel = function(p1, p2)
  437.                   {
  438.                      this.panel1 = p1;
  439.                      this.panel2 = p2;
  440.                   };
  441.                   _loc2_.startUpdate = function()
  442.                   {
  443.                      this.amountIterationsStart = this.amountIterations;
  444.                      if(this.player)
  445.                      {
  446.                         this.update = this.chackKeys;
  447.                      }
  448.                      else
  449.                      {
  450.                         this.update = this.updateWay;
  451.                      }
  452.                   };
  453.                   ┬º┬ºpush(ASSetPropFlags(engine.Auto.prototype,null,1));
  454.                }
  455.                ┬º┬ºpop();
  456.             }
  457.             break;
  458.          }
  459.          set("\x01",eval("\x01") - 58);
  460.          if(┬º┬ºpop())
  461.          {
  462.             set("\x01",eval("\x01") - 383);
  463.          }
  464.       }
  465.    }
  466. }
  467.